#ifndef APPENGINE_H
#define APPENGINE_H

#include <QCoreApplication>
#include <QDebug>
#include <QMutex>
#include <QObject>
#include <QQmlApplicationEngine>
#include <QQmlContext>
#include <QSettings>

#include "localconfig.h"
#include "languagecontrol.h"
#include "networkmanager.h"

#include "modbuscontrol.h"
#include "printercontrol.h"
#include "scannercontrol.h"

#include "usb_process_list_model.h"
#include "online_process_list_model.h"

#include "Order_Process/order_process_manager.h"

class AppEngine : public QQmlApplicationEngine
{
    Q_OBJECT

public:
    static AppEngine *m_instance;
    static QMutex m_mutex;

    static AppEngine *getInstance();

    static void destroyInstance();

    // 注册到QML
    void registerToQML();

private:
    AppEngine(QObject *parent = nullptr);
    ~AppEngine();
    AppEngine(const AppEngine &) = delete;
    AppEngine &operator=(const AppEngine) = delete;

    // 本地配置类
    LocalConfig *m_Config = nullptr;
    // 语言控制类
    LanguageControl *m_Language = nullptr;
    // 网络管理类
    NetWorkManager* m_NetWorkManager = nullptr;


    // PLC 控制类
    ModbusControl *m_Modbus = nullptr;
    // 打印机控制类
    PrinterControl *m_Printer = nullptr;
    // 扫码枪控制类
    ScannerControl *m_Scanner = nullptr;

    // U盘加工料单
    USB_Process_List_Model* m_USB_Process_List_Model = nullptr;
    // 网络料单
    Online_Process_List_Model* m_Online_Process_List_Model = nullptr;
    // 本地料单
    Order_Process_Manager* m_Order_Process_Manager = nullptr;

signals:
};

#endif // APPENGINE_H
